import jakarta.servlet.*;
/*
*   servlet 程序
*       1.maven中的webapp工程
*       2.pom中配置依赖，(servlet相关的)
*       3.创建具体的类，实现servlet接口，重写方法(service方法是实现servlet程序的核心)
*       4.在web.xml中配置实现类的路径
*       5.启动tomcat，访问servlet程序
*       6.在浏览器中输入servlet访问路径，即可访问servlet程序
*
* */
import java.io.IOException;

public class ServletDemo01 implements Servlet {

    @Override
    public void init(ServletConfig servletConfig) throws ServletException {

    }

    @Override
    public ServletConfig getServletConfig() {
        return null;
    }

    @Override
    public void service(ServletRequest servletRequest, ServletResponse servletResponse) throws ServletException, IOException {
        System.out.println("Hello service");
        String res = "<h3>111</h3>";
        servletResponse.setContentType("text/html; charset=UTF-8");
        servletResponse.setCharacterEncoding("UTF-8");
        servletResponse.getWriter().write("<h3>six对是</h3>");
    }

    @Override
    public String getServletInfo() {
        return null;
    }

    @Override
    public void destroy() {

    }
}
